package com.link.base.base.duty.dao.mybatis.mapper;

import com.link.base.base.user.model.User;
import com.link.base.base.common.model.InterObject;
import com.link.base.base.common.model.Menu;
import com.link.base.base.common.model.MenuTree;
import com.link.base.base.duty.model.Duty;
import com.link.base.base.duty.model.DutyDto;
import com.link.base.base.urlinfo.model.UrlInfo;
import com.link.core.basic.dao.mapper.BasicMapper;

import java.util.List;
/**
 * Copyright  hande Company. All Rights Reserved.
 *
 * @author  unknwon
 * @date:   2018/11/9 16:50
 * @version 1.0
 */

public interface DutyMapper extends BasicMapper<Duty> {

    /**
     * 查询菜单列表：分页查询职责关联的菜单
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> queryDutyOfMenuListPage(Menu record) throws Exception;

    /**
     * 查询职责列表，分页查询菜单关联的职责
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Duty> queryDutyListOfMenuPage(Menu record) throws Exception;

    /**
     * 查询职责列表，如果是000账套，则去除cropid限制
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Duty> queryDutyListPage(Duty record) throws Exception;

    /**
     * 查询用户列表：分页查询职责关联的用户
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<User> queryDutyOfUserListPage(User record) throws Exception;

    /**
     * 查询菜单列表：查询未关联职责的菜单
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> queryUnSelectMenuListPage(Menu record) throws Exception;

    /**
     * 查询安全性菜单列表：为关联职责菜单
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> queryUnSelectSubMenuListPage(Menu record) throws Exception;

    /**
     * 查询未被 当前二级菜单关联的 职责列表
     *
     * @author zhangyuhao
     * @time 2019-2-18 11:10:58
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Duty> queryunSelectDutyOfMenuPage(Duty record) throws Exception;

    /**
     * 查询用户列表：查询未关联职责的用户
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<User> queryUnSelectUserListPage(User record) throws Exception;

    /**
     * 添加菜单：给职责添加菜单
     *
     * @param record
     * @throws Exception
     */
    public void addMenuOfDutyInsert(Menu record) throws Exception;

    /**
     * 添加菜单：给职责添加菜单
     *
     * @param record
     * @throws Exception
     */
    public void addUserOfDutyInsert(User record) throws Exception;

    /**
     * 添加菜单：给职责添加菜单的父菜单
     *
     * @param record
     * @throws Exception
     */
    public void addParentMenuOfDutyInsert(Menu record) throws Exception;

    /**
     * 删除菜单：根据Id删除菜单
     *
     * @param record
     * @throws Exception
     */
    public void delMenuOfDuty(InterObject record) throws Exception;

    /**
     * 删除菜单：根据Id删除父菜单
     *
     * @param record
     * @throws Exception
     */
    public void delMenuParentOfDuty(InterObject record) throws Exception;

    /**
     * 根据二级菜单id和职责Id去中间表查询二级菜单对应的一级菜单下的所有二级菜单
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> querySecMenuIdListBySecMenuIdAndDutyIdFromMenuOfDuty(InterObject record) throws Exception;

    /**
     * 删除用户：根据Id删除用户
     *
     * @param record
     * @throws Exception
     */
    public void delUserOfDuty(InterObject record) throws Exception;

    /**
     * 删除菜单：根据parentId删除菜单
     *
     * @param record
     * @throws Exception
     */
    public void delMenuByParentId(Menu record) throws Exception;

    /**
     * 根据菜单类型获取菜单列表
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> getMenuListByMenuTyepSelect(Menu record) throws Exception;

    /**
     * 查询二级菜单的父菜单是否已存在中间表
     *
     * @param record
     * @return list
     * @throws Exception
     */
    public InterObject queryParentMenuExistByMenuOfDuty(Menu record) throws Exception;

    /**
     * <p>更新职责菜单中间表数据</p>
     *
     * @author yrf
     * @param record
     * @return list
     * @throws Exception
     */
    public int menuOfDutyUpdate(Menu record) throws Exception;

    /**
     * <p>查询未选中关联职责的url信息</p>
     *
     * @author yrf
     * @param record
     * @return list
     * @throws Exception
     */
    public List<UrlInfo> queryUnSelectUrlListPage(UrlInfo record) throws Exception;

    /**
     * <p>根据职责ID删除中间表中职责-菜单关联记录</p>
     *
     * @author yrf
     * @param duty
     * @return list
     * @throws Exception
     */
    public int deleteLinkMenuByDutyId(Duty duty) throws Exception;

    /**
     * <p>根据职责ID删除中间表中职责-用户关联记录</p>
     *
     * @author yrf
     * @param duty
     * @return list
     * @throws Exception
     */
    public int deleteLinkUserByDutyId(Duty duty) throws Exception;

    /**
     * <p>根据职责ID删除中间表中职责-url关联记录</p>
     *
     * @author yrf
     * @param duty
     * @return list
     * @throws Exception
     */
    public int deleteLinkUrlByDutyId(Duty duty) throws Exception;

    /**
     * 通过dutyId查找菜单
     * @param record
     * @return list
     * @throws Exception
     */
    public List<Menu> queryMenuByDutyId(Menu record) throws Exception;


    /**
     * 删除菜单：根据职责Id删除菜单及安全性菜单
     * @param record
     * @throws Exception
     */
    public void delAllMenuOfDuty(InterObject record) throws Exception;

    /**
     * 删除职责：删除用户下的职责
     *
     * @param record
     * @throws Exception
     */
    public void delDutyByUserId(InterObject record) throws Exception;

    /**
     * 查询未被当前url关联的职责列表
     *
     * @author yaojiangyi
     * @date 2019/02/28 16:53
     * @param record 职责
     */
    public List<Duty> queryunSelectDutyOfUrlPage(Duty record) throws Exception;

    /**
     * 在快捷设置中被取消掉的数据
     * 删除职责和安全性菜单的关联关系
     *
     * @author yangxiaolin
     * @date 2019/03/07 15:29
     * @param menuTree
     * @throws Exception
     */
    public void delAllQuickDutySafety(MenuTree menuTree) throws Exception;

    /**
     * 在快捷设置中被选中的数据
     * 添加职责和安全性菜单的关联关系
     *
     * @author yangxiaolin
     * @date 2019/03/07 15:29
     * @param subList
     * @throws Exception
     */
    public void insertQuickSafetyDutyMenu(List<MenuTree> subList) throws Exception;

    List<DutyDto> queryUsersDutyListPage(DutyDto t);

    /**
     * 根据菜单id查询关联的职责ids
     *
     * @author qinxg
     * @date 2020/7/8
     * @param menu 菜单对象
     * @return
     **/
    List<Long> queryDutyIdsByMenuId(Menu menu) throws Exception;
}
